package com.school.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.school.pojo.Attendance;
import com.school.service.AttendanService;
import com.school.util.Result;
import com.school.util.Tool;

@RequestMapping("/attendan")
@RestController
public class AttendanCecontroller implements Tool<Attendance>{
	@Autowired
	private AttendanService attendanService;

	@Override
	@RequestMapping("/findAll")
	public Result<Attendance> findAll(int page, int pageSize, Attendance t) {
		List<Attendance> atten= attendanService.findAll(page,pageSize,t);
		PageInfo<Attendance> info=new PageInfo<Attendance>(atten);
		Result<Attendance> result=new Result<Attendance>();
		result.setCount(info.getTotal());
		result.setList(info.getList());
		return result;
	}

	@Override
	@RequestMapping("/findById")
	public Result<Attendance> findbyId(int id) {
		List<Attendance> attendance=  attendanService.findbyId(id);
		Result<Attendance> result=new Result<Attendance>();
		result.setList(attendance);
		return result;
	}

	@Override
	public int add(Attendance t) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int edit(Attendance t) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int del(int id) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delbatch(int[] id) {
		// TODO Auto-generated method stub
		return 0;
	}
}
